@Inject('$log', '$scope', '$http', '$stateParams', 'globalService', 'ngDialogService')
class DocumentPreviewController {
  constructor() {
    this.id = $stateParams.id;
    this.canPreview = true;

    this.$init(this.id);
  }

  $init(id) {
    this.globalService.previewDoc(id)
      .then((res) => {
        this.$log.debug(res);
        if (res.success) {
          this.previewUris = res.data.filePath;
        } else {
          this.canPreview = false;
          this.ngDialogService.alertError(res.message);
        }
      });
  }

}

export default DocumentPreviewController;

